<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title></title>
    <style>
      .container {
        width: 500px;
        height: 500px;
        /* background: violet; */
        position: relative;
      }
      .container div{
        border: 1px solid red;
        width: 200px;
        height: 200px;
      }
      .box1{
        /* position: absolute; */
        /* top: 20px; */
        /* left: 20px; */
        background: wheat;
      }
      .box3{
        position: absolute;
        top: 20px;
        left: 20px;
        background: red;
      }
      .box2{
        position: sticky;
        top:0;
        left: 0;
        width: 100px;
        background: firebrick;
        height: 200px;
      }
    </style>
  </head>
  <body>
    <!-- //基于自己的父级做继承 -->
    <div class="container">
      <div class="box1">
        <div class="box3"></div>
      </div>
      <div class="box2"></div>
    </div>
    <script></script>
  </body>
</html>
